home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
SYS_TOOL
/
MULTI020
/
MPKBD.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-09-07
|
1KB
|
46 lines
unit MPKbd;
{ Provide client which puts input from the keyboard into a pipe }
interface
uses crt, multi, mpipes;
procedure AttachKbdTask(m : pPipe);
{ Attach a task which polls the keyboard and feeds the pressed chars
into the given pipe. That task sets #AltXPressed# if Alt-X is found
within the stream of keyboard data. }
implementation
const
keyboardthere : boolean = false;
procedure KbdInTask(var m); far;
var
p : tPipe absolute m;
ch : char;
begin
p.NewInputTask;
if keyboardthere then begin p.NoMoreInput; exit end;
keyboardthere := true;
t^.hasexit := true;
repeat
if keypressed then begin
ch := readkey;
if (ch = #0) then begin
ch := readkey;
if (ch = #45) or p.Put(#0) or p.Put(ch) then break
end else
if p.Put(ch) then break;
end;
if Switch then break;
until false;
p.NoMoreInput;
keyboardthere := false
end;
procedure AttachKbdTask(m : pPipe);
begin
Fork(KbdInTask,2048,m^{$IFDEF DEBUG},'KbdIn'{$ENDIF});
end;
end.